﻿//Keywords Screensaver 
//Copyright (C) 2011 Douglas Morrison 

//This program is free software: you can redistribute it and/or modify it under the terms of 
//the GNU General Public License as published by the Free Software Foundation, either version 3 
//of the License, or (at your option) any later version. This program is distributed in the hope 
//that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
//of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
//for more details. For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>. 

//Contact the developer at: 
//http://groups.google.com/group/keywords-screensaver

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace scrSaver
{
    public partial class Settings : Form
    {
        public Settings()
        {
            InitializeComponent();
        }

        private void savebutton_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.RefreshFreq = (Convert.ToInt32((string)comboBox1.SelectedItem.ToString()));
            Properties.Settings.Default.KeywordsPath = keyfile.Text;
            Properties.Settings.Default.Save();

            this.Close();
        }

        private void label3_Click(object sender, EventArgs e)
        {
            Form CopyrightNotice = new CopyrightNotice();
            CopyrightNotice.Show();
        }

        private void Settings_Load(object sender, EventArgs e)
        {
            string mystr = (Convert.ToString(Properties.Settings.Default.RefreshFreq));
            comboBox1.Text = mystr;
            keyfile.Text = Properties.Settings.Default.KeywordsPath;

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string myString = Properties.Settings.Default.KeywordsPath;
            string myPath = System.IO.Path.GetDirectoryName(myString);
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.InitialDirectory = myPath;
            string filename = "";
            string path = "";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                filename = System.IO.Path.GetFileName(ofd.FileName);
                path = System.IO.Path.GetDirectoryName(ofd.FileName);
                keyfile.Text = path + "\\" + filename;
            }
            
        }

        private void label5_Click(object sender, EventArgs e)
        {

        }
    }
}
